<?php echo $this->Session->flash(); ?>
<?php echo $javascript->link('jquery.ui.datepicker-es'); ?>
<script>
 
    $(".form_validate").validate();

</script>
<script>
    $(document).ready(function(){
        $(".campofecha").datepicker({
            yearRange: '1900:2010',
            showOn: 'both',
            buttonImage: './img/calendar.jpg',
            buttonImageOnly: true,
            changeYear: true,
            numberOfMonths: 1

        });
        selectDiv();
        $('#orden').change(function() {
            selectDiv();
        });
    })
    function selectDiv(){
        if($('#orden option:selected').val()==2){
            $('#divorden').show("slow");
            $('#ord').attr('disabled','');
        }else{

            $('#divorden').hide("slow");
            $('#ord').attr('disabled','disabled');
            $('#ord').attr('value',0);
        }
    }


</script>
<h1>EDITAR ASPIRANTE DATOS DEL ASPIRANTE</h1>
<?php
//echo $form->create('CandidateReview');
echo $this->Form->create('CandidateReview', array('enctype' => 'multipart/form-data', 'type' => 'file', "action" => "add/" . $this->data['Candidate']['id'], 'class' => 'form_validate'));
?>

<fieldset>
    <?php
    echo $this->Form->hidden("Candidate.candidate_id");
    echo $this->Form->hidden("Candidate.id");
    echo $this->Form->hidden("CandidateReview.user_id");
    echo $this->Form->hidden("CandidateReview.fecha");
    echo $this->Form->hidden("Candidate.fecha");
    echo "Número de identificación <br><br>";
    echo $this->data['Candidate']['nro_ident'];
    echo $this->Form->input('Candidate.tipo_ident', array('label' => "Tipo identificacion", 'type' => 'select', 'options' => array(1 => 'C.C', 2 => 'T.I')));
    echo $this->Form->input("Candidate.1er_nombre", array('label' => "Primer Nombre"));
    echo $this->Form->input("Candidate.2do_nombre", array('label' => "Segundo Nombre"));
    echo $this->Form->input("Candidate.1er_apellido", array('label' => "Primer Apellido"));
    echo $this->Form->input("Candidate.2do_apellido", array('label' => "Segundo Apellido"));
    echo $this->Form->input('Candidate.telefono', array('label' => 'Telefono'));
    echo $this->Form->input('Candidate.direccion', array('label' => "Direccion"));
    echo $this->Form->input('Candidate.fecha_nacimiento', array('class' => 'campofecha', 'type' => 'text', 'label' => 'Fecha de nacimiento'));
    echo $this->Form->input('Candidate.departament_id', array('label' => 'Departamento', 'empty' => 'Seleccione'));
    echo $this->Form->input('Candidate.renuncio', array('label' => "¿El aspirante renunció?", 'options' => array(1 => 'Si', 0 => 'No')));
    ?>
    <?php
    echo $ajax->observeField('CandidateDepartamentId', array(
        'url' => array('controller' => 'Candidates', 'action' => 'select'),
        'frequency' => 0.2,
        'update' => 'ciudades'
            )
    );
    ?>

    <div id="ciudades">
        <?php echo $this->Form->input("Candidate.city_id", array('label' => 'Ciudad', 'type' => 'select', 'empty' => 'Seleccione Ciudad')); ?>
    </div>

</fieldset>

<table id="tabla">
    <tr>
        <td><b>Genero</b></td>
        <td>
            <?php
            echo $this->Form->data['Candidate']['genero'] == 1 ? "Hombre" : "Mujer";
            ?>
        </td>
    <tr>
        <td><b>Minoria</b></td>
        <td>
            <?php
            if ($this->data['Candidate']['minoria'] == 0) {
                echo "Ninguna";
            } else if ($this->data['Candidate']['minoria'] == 1) {
                echo "Negro";
            } else if ($this->data['Candidate']['minoria'] == 2) {
                echo "Indigena";
            } else {
                echo "ROM";
            }
            ?>
        </td>
    </tr>
    <tr>
        <td><b>Clase</b></td>
        <td>
            <?php
            echo $this->data['Candidate']['clase'] == 1 ? "Principal" : "Suplente";
            ?>
        </td>
    </tr>
    <tr>
        <td><b>Tipo</b></td>
        <td>
            <?php
            if ($this->data['Candidate']['tipo'] == 2) {
                echo "Campesino";
            } else if ($this->data['Candidate']['tipo'] == 4) {
                echo "Desplazado";
            } else if ($this->data['Candidate']['tipo'] == 5) {
                echo "Profesional";
            }
            ?>
        </td>
    </tr>
</tr>

</table>

<fieldset>
    <legend><h2>OBSERVACIONES SOBRE LA REVISIÓN</h2></legend>
    <?php echo $this->Form->input("CandidateReview.concepto", array('label' => '', 'class' => 'txtarea')); ?>
    <?php //echo $this->Form->input("Candidate.calificacion_sidra", array('label' => 'Calificación', 'options' => array('empty' => 'Seleccione', 'Cumple' => 'Cumple', 'No cumple' => 'No cumple'))); ?>
</fieldset>

<?php
echo $this->Form->end(array('label' => 'Guardar', 'class' => 'submit_button'));
//echo $ajax->submit('Guardar', array('url' => array('controller' => 'candidateReviews', 'action' => 'add', $this->data['Candidate']['id']), 'update' => 'content', 'indicator' => 'loading'));
//echo $form->end();
?>
<br><br>
<br>
<?php
echo $ajax->link($html->image('regresar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Regresar', 'title' => 'regresar')), array('controller' => 'candidateReviews', 'action' => 'index', $this->data['Candidate']['id']), array('update' => 'content', 'indicator' => 'loading', 'escape' => false));
?>
<br>   